home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue10.arc / TVWPRNTF.C < prev    next >
C/C++ Source or Header  |  1988-08-13  |  2KB  |  59 lines

  1. /*================================================*/
  2. /* TVWPRNTF.C                                     */
  3. /*                                                */
  4. /* (c) Copyright 1988 Ralf Brown                  */
  5. /*     All Rights Reserved                        */
  6. /* May be freely copied for noncommercial use as  */
  7. /* long as this copyright notice is kept intact   */
  8. /* and any changes are indicated in the comment   */
  9. /* blocks for the functions                       */
  10. /*================================================*/
  11. /* Unlike most other functions, TVwin_printf() is */
  12. /* definitely nonportable, and requires Turbo C   */
  13. /*================================================*/
  14.  
  15. #include <stdio.h>
  16. #include <stdarg.h>
  17. #include "tvapi.h"
  18.  
  19. /*================================================*/
  20.  
  21. extern OBJECT _TV_printf_mutex_ ;
  22.  
  23. /*================================================*/
  24.  
  25. int pascal __vprinter( void pascal (*putter)(char *,int,void *),
  26.                        void *outP,
  27.                        char *format,
  28.                        va_list argP ) ;
  29.  
  30. /*================================================*/
  31. /* printf_put  internal func to output formatted  */
  32. /*             string                             */
  33. /*   Ralf Brown 5/9/88                            */
  34. /*================================================*/
  35.  
  36. static void pascal printf_put( char *s, int len, void *win )
  37. {
  38.    TVwin_write( *(OBJECT *)win, s, len ) ;
  39. }
  40.  
  41. /*================================================*/
  42. /* TVwin_printf  formatted output to window       */
  43. /*   Ralf Brown 5/9/88                            */
  44. /*================================================*/
  45.  
  46. int cdecl TVwin_printf(OBJECT win,char *format, ...)
  47. {
  48.    int retval ;
  49.  
  50.    if (!TVisobj(_TV_printf_mutex_))
  51.       _TV_printf_mutex_ = TVmbx_new() ;
  52.    TVlock(_TV_printf_mutex_) ;
  53.    retval = __vprinter( printf_put, &win, format, _va_ptr ) ;
  54.    TVunlock(_TV_printf_mutex_) ;
  55.    return retval ;
  56. }
  57.  
  58. /* End of TVWPRNTF.C */
  59.